﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:v="clr-namespace:ShredTheLog.Views;assembly=ShredTheLog.Views"
    xmlns:vm="clr-namespace:ShredTheLog.ViewModels;assembly=ShredTheLog.ViewModels"
    xmlns:cnv="clr-namespace:ShredTheLog.Converters;assembly=ShredTheLog.Converters"
    >
    
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="FlashImages\Padlock.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <ControlTemplate x:Key="MainTabControlTemplate" TargetType="{x:Type TabControl}">
        <DockPanel>
            <Grid Background="#FEF1B2" DockPanel.Dock="Top">
                <!--Линия, отчеркивающая шапку формы-->
                <Line VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Stretch="Fill" X1="0" Y1="0" X2="1" Y2="0" StrokeThickness="3">
                    <Line.Stroke>
                        <LinearGradientBrush StartPoint="0, 0" EndPoint="0, 1">
                            <GradientStop Offset="0" Color="#EFD87C"/>
                            <GradientStop Offset="0.3333333" Color="#E9D48B"/>
                            <GradientStop Offset="0.6666666" Color="#D7C07C"/>
                        </LinearGradientBrush>
                    </Line.Stroke>
                </Line>

                <Grid ClipToBounds="true" KeyboardNavigation.TabNavigation="Local" Width="910" Cursor="Hand">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <!--Желтая градиентная фоновая полоска наверху главного окна-->
                    <Border Grid.ColumnSpan="3" BorderThickness="3, 0, 3, 3" BorderBrush="#9B6E00" CornerRadius="3">
                        <Border.Background>
                            <LinearGradientBrush StartPoint="0.4995, 0" EndPoint="0.5005, 1">
                                <GradientStop Offset="0" Color="#FEE628"/>
                                <GradientStop Offset="0.5" Color="#FEE628"/>
                                <GradientStop Offset="0.5" Color="#FFD200"/>
                                <GradientStop Offset="1" Color="#FFD200"/>
                            </LinearGradientBrush>
                        </Border.Background>
                        <Rectangle>
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0, 0" EndPoint="1, 0">
                                    <GradientStop Offset="0" Color="#FCD200"/>
                                    <GradientStop Offset="1" Color="Transparent"/>
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                    </Border>

                    <TextBlock Grid.Column="0" VerticalAlignment="Center" Margin="10, 0, 10, 0">
                        <TextBlock FontSize="24"><Bold>Rosetta</Bold>Stool</TextBlock>
                        <Border CornerRadius="3" Background="#FFF064" VerticalAlignment="Bottom">
                            <Border.Effect>
                                <DropShadowEffect Direction="-45" Color="Black" BlurRadius="1" ShadowDepth="2" Opacity="0.5"/>
                            </Border.Effect>
                            <TextBlock Padding="2" FontSize="16">
                                <Bold>Shred</Bold>theLog
                                <TextBlock Text="©" FontSize="14" Foreground="Gray">
                                    <TextBlock.LayoutTransform>
                                        <RotateTransform Angle="180"/>
                                    </TextBlock.LayoutTransform>
                                </TextBlock>
                            </TextBlock>
                        </Border> 
                    </TextBlock>
                                    
                    <TabPanel x:Name="HeaderPanel" Margin="0,0,0,0" IsItemsHost="true" Panel.ZIndex="1" Grid.Column="1" KeyboardNavigation.TabIndex="1" Background="Transparent"/>
                    
                    <Button Grid.Column="2" Focusable="False">
                        <Button.Style>
                            <Style TargetType="{x:Type Button}">
                                <Setter Property="Content" Value="{Binding LogOutCommand.Name}"/>
                                <Setter Property="Command" Value="{Binding LogOutCommand}"/>
                                <Setter Property="Background" Value="Transparent"/>
                                <Setter Property="Margin" Value="10, 0, 10, 3"/>
                                <Setter Property="Padding" Value="2"/>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type Button}">
                                            <Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
                                                <DockPanel>
                                                    <Image DockPanel.Dock="Left" Source="{StaticResource Horizon_Image_Padlock}" Stretch="Uniform" Height="32"/>
                                                    <AccessText x:Name="textBlock" DockPanel.Dock="Top" Text="{TemplateBinding Content}" VerticalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center" Width="60" Foreground="#3F4D8A"/>
                                                </DockPanel>
                                            </Border>
                                            <ControlTemplate.Triggers>
                                                <Trigger Property="IsMouseOver" Value="True">
                                                    <Setter Property="Background" Value="#C0FFF8A0"/>
                                                </Trigger>
                                                <DataTrigger Binding="{Binding Credentials}" Value="{x:Null}">
                                                    <Setter Property="Content" Value="{Binding ShowLogInDialogCommand.Name}"/>
                                                    <Setter Property="Command" Value="{Binding ShowLogInDialogCommand}"/>
                                                </DataTrigger>
                                            </ControlTemplate.Triggers>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>    
                        </Button.Style>   
                    </Button>
                </Grid>
            </Grid>
            <Border x:Name="ContentPanel" Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="1" KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                <ContentPresenter x:Name="PART_SelectedContentHost" Margin="{TemplateBinding Padding}" ContentSource="SelectedContent"/>
            </Border>
        </DockPanel>
    </ControlTemplate>

</ResourceDictionary>